<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head><title>TravelDream</title>
	<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'/>
</h:head> 
<body> 

	
	<h:outputStylesheet library="css" name="primefaces-style.css"/>

	<p:panel header="Admin Console">
		<h:panelGrid columns="10" cellpadding="3">
			<h:link outcome="homePage" value="Admin Console"/>
			
			 <h:link outcome="createTravelPackage" value="new package" />  
			  
			  <h:link outcome="newFlight" value="new flight"/>
			  
			  <h:link outcome="newHotel" value="new hotel"/> 
			  
			  <h:link outcome="newExcursion" value="new excursion"/>
			  
			  <h:link outcome="showAllPackages" value="show all packages" /> 
			 
			  <h:link outcome="showAllHotels" value="show All Hotels"/> 
			   
			  <h:link outcome="showAllFlights" value="show All flights"/>
			   
			  <h:outputText value="show all excursions" /> 
			  
			  <h:link outcome="manageCity" value="manage city"/>
			  
	 
			  <h:form>
				<p:commandButton id="logoutButton" value="logout" action="#{logout.logout()}"/>
			</h:form>
		</h:panelGrid>
	</p:panel>
	
<div id="result">

	<p:panel header="All Excursion" rendered="#{!excursion.edit}" styleClass="green-header">
			
			<h:form>  
		    	<p:dataTable id="excursion" var="ExcursionDTO" value="#{excursion.allExcursionList}">  
		    	 
			       <p:column headerText="Id" filterBy="id" filterMatchMode="contains">  
			            <h:outputText value="#{ExcursionDTO.id}" />  
			       </p:column>  

			      <p:column headerText="name" filterBy="name" filterMatchMode="contains">  
			            <h:outputText value="#{ExcursionDTO.name}" />  
			        </p:column>  
			        
			        <p:column headerText="Description">  
			            <h:outputText value="#{ExcursionDTO.description}" />  
			        </p:column> 
			        
			         <p:column headerText="Price(EUR)">  
			            <h:outputText value="#{ExcursionDTO.price}" />  
			        </p:column>  
			        
			        <p:column headerText="IsActive">  
			            <h:outputText value="#{ExcursionDTO.active}" />  
			        </p:column>

			       <p:column headerText="">  
			            <p:commandButton value="edit" action="#{excursion.edit(ExcursionDTO)}" ajax="false" /> 
			        </p:column>
			        
			         <p:column headerText="">  
			        <p:commandButton value="Delete" action="#{excursion.remove(ExcursionDTO)}" ajax="false"/>
			        </p:column>
			        
			        <p:column headerText="">  
			            <p:commandButton value="Activate" action="#{excursion.activate(ExcursionDTO)}" ajax="false" 
			            	rendered="#{!ExcursionDTO.active}"/> 
  
			            <p:commandButton value="Disable" action="#{excursion.disable(ExcursionDTO)}" ajax="false" 
			            rendered="#{ExcursionDTO.active}"/> 
			        </p:column>
			     		  
    	</p:dataTable>  
	</h:form>  
	
			</p:panel>
	
	
	
	<p:panel id="editExcursion_p" header="Edit Excursion" rendered="#{excursion.edit}" styleClass="green-header">
	<h:form id="editExcursion_f">
        <h:panelGrid columns="3" cellpadding="5">  
          	
          	<h:outputText value="Id" />
			<p:inputText value="#{excursion.currentExcursion.id}" />
			<h:outputText value="#{excursion.errorId}" />
							
			<h:outputText value="Name" />
			<p:inputText  value="#{excursion.currentExcursion.name}" />
			<h:outputText value="#{excursion.errorName}" />

			
			<h:outputText value="Description" />
			<p:inputTextarea rows="8" cols="40" id="description" value="#{excursion.currentExcursion.description}" />
			<h:outputText value="#{excursion.errorDescription}" />
			
			<h:outputText value="Price" />
			<p:inputText id="price" value="#{excursion.currentExcursion.price}" />
			<h:outputText value="#{excursion.errorPrice}" />
			
			
			<p:commandButton  value="save" action="#{excursion.saveEdit()}"  ajax="false"/>
        	<p:commandButton  value="cancel" action="#{excursion.cancel()}"  ajax="false"/>
        	
        </h:panelGrid>
         </h:form> 
         
	
        </p:panel> 

	<h:form>
		<p:panel header="Error" rendered="#{excursion.showError}" styleClass="error-header">
		<h:outputText value="#{excursion.errorDelete}" />
		<h:outputText value="#{excursion.errorEdit}" />
		<p:commandButton value="ok" action="#{excursion.cancel()}" ajax="false"/>
	</p:panel>
	</h:form>
	
	
		
</div>
</body> 
</html>
